home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / nameless.swf / scripts / DefineSprite_44_missile / frame_1 / DoAction.as
Encoding:
Text File  |  2011-06-09  |  942 b   |  48 lines

  1. stop();
  2. if(!setVars)
  3. {
  4.    var dropSpeed = 0;
  5.    var maxDropSpeed = 18;
  6.    var airSpeed = 1;
  7.    var setVars = true;
  8. }
  9. var onEnterFrame = function()
  10. {
  11.    if(_root.pauseMode == false)
  12.    {
  13.       if(_root.cm.hitTest(this))
  14.       {
  15.          if(_currentframe == 1)
  16.          {
  17.             gotoAndStop("explode");
  18.          }
  19.          else if(_currentframe == 2 && !took && _root.cm.hitTest(g.hitter))
  20.          {
  21.             took = true;
  22.             if(_root.cm.hit == false)
  23.             {
  24.                _root.cm.hit = true;
  25.                _root.health -= 5;
  26.             }
  27.          }
  28.       }
  29.       if(_root.bound.hitTest(_X,_Y,true))
  30.       {
  31.          gotoAndStop(2);
  32.       }
  33.       if(_currentframe == 1)
  34.       {
  35.          _Y = _Y + dropSpeed;
  36.          if(dropSpeed < maxDropSpeed)
  37.          {
  38.             dropSpeed += airSpeed;
  39.          }
  40.       }
  41.       g.play();
  42.    }
  43.    else
  44.    {
  45.       g.stop();
  46.    }
  47. };
  48.